$(document).ready(function(){
	// Default view when load the page
	loadTemplate('includes/home.html', 'home', 0);
	
	// On refresh the page
	$(window).bind('beforeunload',function(){
	});
	
	// Back and Forward Browser buttons control
	$(window).bind("popstate", function () {
//		$.getScript(location.href);
	});
	  
	
	$("#btnNyomtatas").click(function(){
		loadTemplate('includes/nyomtatas.html', 'nyomtatas', 0);
		return false;
    });
	$("#btnSzkenneles").click(function(){
		loadTemplate('includes/szkenneles.html', 'szkenneles', 0);
		return false;
	});
});


function loadTemplate(url,title,option) {
	var info = "lang=" + $('html').attr('lang');
	var link = title;
	$.getScript(this.href);
	history.pushState(null, "", "index.html#"+link);
//	info = "OP="+option;
	$.ajax({
        async: false,
        cache: false,
		url: url,
		type: "GET",
		data: info,
		success: function(info){
			$("#content").html(info);
		}
	});
}